The effect of light on sleep patterns is roughly understood—with studies showing that the timing of, and quality of, light that excites a person's senses can have a very real effect on the person's ability to get to sleep quickly at night, and to have quality sleep. For example, students who use portable electronic devices before bedtime tend to get substantially less sleep than those who do not.
Such light can affect a person's production of melatonin, a hormone that anticipates the daily onset of darkness. Melatonin is used to synchronize circadian rhythms of physiological functions that include sleep timing, blood pressure, and seasonal reproduction. Released by the pineal gland starting a couple hours before ordinary sleeping time, melatonin reduces alertness and makes sleep more inviting. Jet lag is one example of problems created by a mismatch between a person's external environment and circadian phase—where the person's local time zone changes, and his or her lighting situation does not match his or her pattern for melatonin release. And it is light, particularly from the cool (blue) end of the color spectrum and typically produced by electronic devices like laptops and tablets, that can keep the pineal gland from releasing melatonin. The effects can be particularly serious for teenagers, whose circadian rhythms are already shifting (and out of alignment with normal societal sleep timing) due to their aging, and who are very likely to use portable computing devices that are often held very close to the face.
A person's production of melatonin can be affected positively by varying the color temperature of light presented to the person, such as by changing the color of light bulbs or computer displays toward the warmer (red) end of the color spectrum in the evening.